{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5f8f1360-bff4-4c83-9d44-c6c835f6ae8d",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\anaconda3\\Lib\\site-packages\\keras\\src\\layers\\reshaping\\flatten.py:37: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n",
      "  super().__init__(**kwargs)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential\"</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1mModel: \"sequential\"\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃<span style=\"font-weight: bold\"> Layer (type)                         </span>┃<span style=\"font-weight: bold\"> Output Shape                </span>┃<span style=\"font-weight: bold\">         Param # </span>┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Flatten</span>)                    │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">784</span>)                 │               <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                        │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>)                 │         <span style=\"color: #00af00; text-decoration-color: #00af00\">100,480</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_1 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                      │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>)                  │           <span style=\"color: #00af00; text-decoration-color: #00af00\">1,290</span> │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n",
       "</pre>\n"
      ],
      "text/plain": [
       "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃\u001b[1m \u001b[0m\u001b[1mLayer (type)                        \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape               \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m        Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten (\u001b[38;5;33mFlatten\u001b[0m)                    │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m784\u001b[0m)                 │               \u001b[38;5;34m0\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense (\u001b[38;5;33mDense\u001b[0m)                        │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m)                 │         \u001b[38;5;34m100,480\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_1 (\u001b[38;5;33mDense\u001b[0m)                      │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m10\u001b[0m)                  │           \u001b[38;5;34m1,290\u001b[0m │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m4s\u001b[0m 2ms/step - loss: 0.2541 - sparse_categorical_accuracy: 0.9279\n",
      "Epoch 2/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.1114 - sparse_categorical_accuracy: 0.9668\n",
      "Epoch 3/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0770 - sparse_categorical_accuracy: 0.9771\n",
      "Epoch 4/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0568 - sparse_categorical_accuracy: 0.9827\n",
      "Epoch 5/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0444 - sparse_categorical_accuracy: 0.9862\n",
      "313/313 - 1s - 2ms/step - loss: 0.0768 - sparse_categorical_accuracy: 0.9757\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 54ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 30ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 29ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 29ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 30ms/step\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAACQCAYAAAB3anPqAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAJ05JREFUeJzt3XlclNX+B/APy7CIJoiKil4sxaUilxTUNM0syzI1L5LdtLQM27TULLyueTOLtNXS7s2uive69VMT11zTXHApNTdcWyyCRAnZGb6/P3x57hmZ0ZlhZhhmPu/Xi1dfHp7nzJnn28DxnOec4yMiAiIiIvJqvpVdASIiIqp8bBAQERERGwRERETEBgERERGBDQIiIiICGwREREQENgiIiIgIbBAQERERnNwg+M9//oONGzfaff3ChQvx+uuvIz8/3+S4iGD06NHYs2fPDcuYNm0a5s6di7KyMnUsKysLTzzxBFJTU+2uW1XGvLgv5sZ9MTfuiXlxHH9nFr5w4ULExMSgR48eAID09HT4+voiKCjI5Dyj0Yi8vDzceuut6lh+fj6SkpJQo0YNdOjQAQBQUFCAfv36Ye3atZg5cybatm2LyMhIAEBRURHq16+PatWqqTKKi4uRnJyMrl27YuDAgQgMDISvry/y8vKwcOFC9O/f36QORqMRAQEBTrsf7oJ5cV/MjftibtwT8+JA4kSPPvqoTJw4UX3fqlUrAWDxSzd48GCpVq2aNGzYUIKDgyUmJkaaNm0qZ8+elebNm0twcLBUq1ZN/Pz8JDQ0VAIDA2Xr1q0mZSxfvlwASFpamkRERFz3tQHI6NGjrX5v+fn58txzz0mtWrXE399f2rRpIwcOHKjYDXMRT83L2bNnLZYR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tyTtXlhDwERERGxQUBERERsEBARERHYICAiIiKwQUBERESohO2PiajqOH78uIqbNWum4oYNG6r4119/dWmdiMg52ENAREREbBAQERERhwyICED9+vVV/MYbb6g4OjpaxWPHjlXxb7/95pqKEZHLsIeAiIiI2CAgIiIiwEesXOTYXdaYrlevnorbtWun4p49e6r4vvvuM3vtypUrVTx37lwV//jjjyouLCx0SD2txXXZ3Zenr8seEBCg4kOHDqlYn02gCw8PV/HFixedV7Eb4GfGfVW1z4z+9yQiIkLFgYGBKn7qqafMXtutWzcVt2zZUsXZ2dkqnjZtmorff/99FRuNRnuqazfuZUBERERWY4OAiIiI3GuWwU033aTirl27qnjIkCEqbt++vYojIyNtKv/VV181G+/evVvFQ4cOVbG+KAuRp9FnE+jDBJcuXVJx3759VZyTk+OKahE51fDhw1U8btw4Fdv690RXVlam4tDQUBVHRUWpuCoMU7GHgIiIiNggICIiokqYZeDr+782yLPPPmvys7///e8qttR9o1e3tLRUxWlpaSres2eP2Wvj4uJUfNddd5k9Z8mSJSp+/PHHVax3CTlSVX9iunXr1iretGmTimvVquWyOixevNjk+8cee8wh5Va1J6atcf/996v4k08+UbGerwcffFDFlj5Llamqf2Y8mTt+Zu68806T7/UhYv3vUX5+voqt2Z9j69atKtaHl//5z3+quKCgQMWunlmg4ywDIiIishobBEREROT6IYPevXurWF8o6HrWr1+v4n/9618q/vLLL2167eDgYBUvX75cxXo3qk4f0tBf15E8qftTv0f6bA1nu3Dhgsn3derUcUi57tj9aQ99n4Jvv/1WxX/5y19UnJCQoGJbP1eu5kmfGf2J9ObNm6v45ptvVvHEiRNVrP+/7efnp+Lu3bur+Pvvv3dwLa3njp+Zd9991+T7V155RcX67w7970Bl3kNn4JABERERWY0NAiIiImKDgIiIiCp5pcJrxzVWrFihYn2Mf9euXSo+ffq03a+nTwHRp6bt3btXxU2aNFHxwIEDVeysZwg8ib4C2OzZs1X8t7/9zez5/fv3V3HDhg3tft2pU6fafa03+OKLL1TcuHFjFb/99tsqdvfnBj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BVnZWU5v2JVgL5qHhHdWPv27VWsDxPov1/27Nnj0jqRqRUrVqh4//79Kn766adV3KxZMxUnJCSoWM+dXs57773n4Frajz0ERERExAYBERERVfIsA6o6T0zrG3zoG95Y8n//938q/utf/+qUOjmbpz8xXVVVlc+MrWbPnq3ixMREFeur140dO9aldbIVPzPuibMMiIiIyGpsEBAREVHlzjKgqqNXr14q1vf+rlGjhor1/dmt2QCJiMwrKSlR8axZsyqxJuRN2ENAREREbBAQERERhwzISvoiHDVr1qzEmhB5Pn1/lB9//LESa0LehD0ERERExAYBERERcWGiSuepi6x4Ai6y4p74mXFf/My4Jy5MRERERFZjg4CIiIisHzIgIiIiz8UeAiIiImKDgIiIiNggICIiIrBBQERERGCDgIiIiMAGAREREYENAiIiIgIbBERERAQ2CIiIiAjA/wNs3gTWO+VLVAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 5 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "mnist=tf.keras.datasets.mnist\n",
    "(x_train,y_train),(x_test,y_test)=mnist.load_data()\n",
    "x_train,x_test=x_train/255.0,x_test/255.0\n",
    "model=tf.keras.models.Sequential()\n",
    "model.add(tf.keras.layers.Flatten(input_shape=(28,28)))\n",
    "model.add(tf.keras.layers.Dense(128,activation='relu'))\n",
    "model.add(tf.keras.layers.Dense(10,activation='softmax'))\n",
    "model.summary()\n",
    "model.compile(loss='sparse_categorical_crossentropy',\n",
    "              optimizer='adam',metrics=['sparse_categorical_accuracy'])\n",
    "model.fit(x_train,y_train,batch_size=32,epochs=5)\n",
    "model.evaluate(x_test,y_test,batch_size=32,verbose=2)\n",
    "for i in range(5):\n",
    "    t=np.random.randint(1,10000)\n",
    "    x=tf.reshape(x_test[t],(1,28,28))\n",
    "    y_pred=np.argmax(model.predict(x),axis=1)\n",
    "    plt.subplot(1,5,i+1)\n",
    "    plt.rcParams['font.sans-serif']=['SimHei']\n",
    "    plt.axis(\"off\")\n",
    "    plt.imshow(x_test[t],cmap='gray')\n",
    "    title=\"标签值:\"+str(y_test[t])+\"\\n预测值:\"+str(y_pred[0])\n",
    "    plt.title(title)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "70335869-520e-4ff8-9d8f-8142e0e2dfd5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
